import java.util.concurrent.locks.ReentrantLock;

/**
 * @author wcj
 * @Date 2021/6/7 10:59
 * @Version 1.0
 */
public class ReentrantLockTest {

    int a = 0;
    ReentrantLock lock = new ReentrantLock();

    public void writer() {
        lock.lock();
        try {
            a++;
        } finally {
            lock.unlock();
        }
    }

    public void reader() {
        lock.lock();
        try {
            int a = 0;
        } finally {
            lock.unlock();
        }
    }
}
